package com.example.demo.design.demo15_abstractFactory;

/**
 * Created by 蔡超 on 2018/10/4.
 */
public class Client {

    public static void main(String[] args) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
        //第一种方法，抽象工厂模式
        Factory factory = new HPFactory();
        HPMouse hpMouse = (HPMouse) factory.createMouse();
        System.out.println(hpMouse);

        Factory factory1 = new DellFactory();
        DellKeyboard dellKeyboard = (DellKeyboard) factory1.createKeyboard();
        System.out.println(dellKeyboard);

        //第二种方法 加入简单工厂
        HPMouse hpMouse1 = (HPMouse) DataAccess.createMouse("HP");
        System.out.println(hpMouse1);

        //第三种，反射+读取配置文件
        DellKeyboard dellKeyboard1 = (DellKeyboard) DataAccess.createKeyboard("Dell");
        System.out.println(dellKeyboard1);

    }

}
